package at.ac.univie.ise.common;

import java.util.Properties;
import java.util.Random;

import de.pyranja.util.Utils;

public class Config {
	
	// singleton
	private static Config instance = new Config();

	public static Config getInstance() {
		return instance;
	} // endof singleton ------------------------------------------------>

	private double actionChance;
	private int carScale;
	private Properties config;
	private int cycles;
	private double damageChance;
	private Properties dbconfig;
	private int personScale;
	private Random rng;
	private int stationScale;
	
	// singleton constructor
	protected Config() {
		rng = new Random(System.currentTimeMillis());
		config = Utils.loadProps(Constants.FILLER_PROP_FILE);
		dbconfig = Utils.loadProps(Constants.DB_PROP_FILE);
		personScale = Integer.parseInt(config.getProperty("count.persons"));
		stationScale = Integer.parseInt(config.getProperty("count.stations.city"));
		carScale = Integer.parseInt(config.getProperty("count.cars.station"));
		cycles = Integer.parseInt(config.getProperty("count.cycles"));
		actionChance = Double.parseDouble(config.getProperty("sim.actionchance"));
		damageChance = Double.parseDouble(config.getProperty("sim.damagechance"));
	}
	
	public String getBundleBase() {
		return config.getProperty(Constants.BUNDLEBASE);
	}

	/**
	 * @return the actionChance
	 */
	public double getActionChance() {
		return actionChance;
	}

	/**
	 * @return the config
	 */
	public Properties getConfig() {
		return config;
	}

	/**
	 * @return the damageChance
	 */
	public double getDamageChance() {
		return damageChance;
	}

	/**
	 * @return the dbconfig
	 */
	public Properties getDbconfig() {
		return dbconfig;
	}

	/**
	 * @return the fzgScale
	 */
	public int getCarScale() {
		return carScale;
	}

	/**
	 * @return the personScale
	 */
	public int getPersonScale() {
		return personScale;
	}

	/**
	 * @return the rng
	 */
	public Random getRng() {
		return rng;
	}

	/**
	 * @return the stationScale
	 */
	public int getStationScale() {
		return stationScale;
	}

	/**
	 * @return the weeks
	 */
	public int getCycles() {
		return cycles;
	}
}
